﻿CREATE PROCEDURE [acms].[ControlType_Delete]
	@Id int, 
	@ConcurencyId rowversion
AS
	if exists (Select null From [ControlTypes] where Id = @Id and SiteId is not null and Deleted = 0) begin
		Update [ControlTypes] Set Deleted = 1 Where Id = @Id and ConcurencyId = @ConcurencyId
	end
	else if exists (Select null From [ControlTypes] where Id = @Id and SiteId is not null and Deleted = 0) begin
		return -100
	end
	else begin
		return -200
	end

RETURN 0;